package com.jdz.noise.service.impl;

import com.jdz.noise.dao.FlyStatusDao;
import com.jdz.noise.dao.SphereDao;
import com.jdz.noise.entities.FlyStatus;
import com.jdz.noise.service.FlyService;
import com.jdz.noise.tools.ControlUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class FlyServiceImpl implements FlyService {
    @Autowired
    private FlyStatusDao flyStatusDao;
    @Autowired
    private SphereDao sphereDao;
    //根据指控时速获取信息
    @Override
    public List<FlyStatus> getFlyRowByIndicatedAirspeed(Double indicated_airspeed) {
        return flyStatusDao.getFlyRowByIndicatedAirspeed(indicated_airspeed);
    }
    //插入飞行参数和声学球的json数据
    public void insertFlyStatusAndNoise(){
        FlyStatus fs=ControlUtil.calAverFlyRow();
        //添加飞行数据
        this.flyStatusDao.insertFlyStatus(fs);
        //添加声学球数据
        this.sphereDao.addSphereData(fs.getSphere_id(), ControlUtil.toJson_Map_3D_Noise());
    }

}
